<?php
if( empty( $_SESSION ) )
{
	session_start();
}
header("Content-Type: text/html; charset=utf-8",true);
include_once("../../includes/cls.config.php");
class capa
{
	public $_db;
	
	public function __construct()
	{
		$this->_db = new mysql();
	}
	
	public function update_ordem( $sql )
	{
		return $this->_db->qry( $sql ) or die ( mysql_error() );
	}
	
	public function select_capa( $id_revista )
	{
		$sql = "SELECT p.id, p.titulo, p.id_revista, p.resumo FROM pagina p INNER JOIN revista r ON p.id_revista = r.id WHERE r.publicar=1 AND p.capa=1 AND p.id_revista = " . $id_revista . " ORDER BY p.ordem DESC";
		
		$pRetorno = $this->_db->qry( $sql );
		$aSaida = array();
		while( $aDados = mysql_fetch_array( $pRetorno, MYSQL_ASSOC ) )
		{
			$aSaida[] = $aDados;
		}
		return $aSaida;
	}
}
?>